<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition template="/templates/default.xhtml">
            <ui:define name="content">
              <h:form>
                <h:panelGrid columns="3">
                    <h:outputLabel value="#{locale.oldPassword}:" />
                    <h:inputSecret id="oldPassword"
                                   label="#{locale.errorOldPassword}"
                                   value="#{changePassword.oldPassword}"
                                   required="true"
                                   validator = "javaclass.OldPasswordValidator">
                          <f:ajax event="change" execute="@this oldPasswordError" render="oldPasswordError" />
                    </h:inputSecret>
                    <h:message for="oldPassword" errorClass="smallError" id="oldPasswordError" style="color:red"/>

                    <h:outputLabel value="#{locale.newPassword}:" />
                    <h:inputSecret id="newPassword1"
                                   label="#{locale.errorNewPassword}"
                                   value="#{changePassword.newPassword}"
                                   required="true"
                                   converter = "javaclass.PasswordConverter"
                                   validator = "javaclass.PasswordValidator">
                        <f:ajax event="change" execute="@this passwordError1" render="passwordError1" />
                    </h:inputSecret>
                    <h:message for="newPassword1" errorClass="invalid" id="passwordError1" style="color:red" />


                    <h:outputLabel value="#{locale.repeatPassword}:" />
                    <h:inputSecret id="newPassword2"
                                   label="#{locale.errorRepeate}"
                                   value="#{changePassword.repeatNewPassword}"
                                   required="true"
                                   converter = "javaclass.PasswordConverter"
                                   validator = "javaclass.PasswordValidator">
                        <f:validator validatorId="javaclass.SamePasswordValidator"/>
                        <f:ajax event="change" execute="@this passwordError2" render="passwordError2" />
                    </h:inputSecret>
                    <h:message for="newPassword2" errorClass="invalid" id="passwordError2" style="color:red" />
                </h:panelGrid>
                <h:commandButton action="#{changePassword.changepassword()}" value="#{locale.change}" />
                <h:commandButton value="#{locale.buttonCansel}" action="#{myCourses.navToMyCourses}" immediate="true"/>
            </h:form>
            </ui:define>
        </ui:composition>

       
    </h:body>
</html>

